package com.hinnotek.amoeba.ui.activity.old

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.lee.common.base.BaseActivity
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.adapters.old.SellProjectRequirementsDetailAdapter
import com.hinnotek.amoeba.bean.old.AmibaInstallByIdBean
import com.hinnotek.amoeba.bean.old.SellPurEntity
import com.hinnotek.amoeba.bean.old.SellPurchaseRequistionDetailBean
import com.hinnotek.amoeba.databinding.ActivitySellProjectRequirementDetailBinding
import java.util.*


class SellProjectRequirementsDetailActivity : BaseActivity<ActivitySellProjectRequirementDetailBinding>() {
    private var adapter: SellProjectRequirementsDetailAdapter? = null
    private val stringList: MutableList<SellPurEntity> = ArrayList()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_sell_project_requirement_detail)
        setLeftVisible(true)
        setTitle("项目需料")
    }

    override fun initVew() {
        val manager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
        bindingView.rlv.layoutManager = manager
        bindingView.rlv.adapter = SellProjectRequirementsDetailAdapter(stringList).also {
            adapter = it
        }
    }

    override fun setData() {
        val sellPurchaseRequistionDetailBean =
            intent.getSerializableExtra("sellPurchaseRequistionDetailBean") as AmibaInstallByIdBean
        for (amibaPurchaseProjects in sellPurchaseRequistionDetailBean.amibaPurchaseProjects) {
            stringList.add(SellPurEntity(0, amibaPurchaseProjects, ""))
        }
        stringList.add(
            SellPurEntity(
                1,
                null,
                sellPurchaseRequistionDetailBean.technicalRequirement
            )
        )
    }
}